package jpa.entitys.promis.sales;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the SALES_BOOKINGS database table.
 * 
 */
@Embeddable
public class SalesBookingPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(name="DOCUMENT_TYPE", unique=true, nullable=false, length=2)
	private String documentType;

	@Column(name="BOOKING_SERIES", unique=true, nullable=false, length=4)
	private String bookingSeries;

	@Column(name="BOOKING_NO", unique=true, nullable=false, precision=6)
	private long bookingNo;

    public SalesBookingPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getDocumentType() {
		return this.documentType;
	}
	public void setDocumentType(String documentType) {
		this.documentType = documentType;
	}
	public String getBookingSeries() {
		return this.bookingSeries;
	}
	public void setBookingSeries(String bookingSeries) {
		this.bookingSeries = bookingSeries;
	}
	public long getBookingNo() {
		return this.bookingNo;
	}
	public void setBookingNo(long bookingNo) {
		this.bookingNo = bookingNo;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof SalesBookingPK)) {
			return false;
		}
		SalesBookingPK castOther = (SalesBookingPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.documentType.equals(castOther.documentType)
			&& this.bookingSeries.equals(castOther.bookingSeries)
			&& (this.bookingNo == castOther.bookingNo);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.documentType.hashCode();
		hash = hash * prime + this.bookingSeries.hashCode();
		hash = hash * prime + ((int) (this.bookingNo ^ (this.bookingNo >>> 32)));
		
		return hash;
    }
}